

#include"SList.h"


void Test1()
{
	SLLNode* pList = NULL;
	SLPushFront(&pList, 1);
	SLprint(pList);

	SLPushFront(&pList, 2);
	SLprint(pList);

	SLPushFront(&pList, 3);
	SLprint(pList);

	SLPushFront(&pList, 4);

	SLprint(pList);
}

void Test2()
{
	SLLNode* pList = NULL;
	SLPushFront(&pList, 1);
	SLprint(pList);

	SLPushFront(&pList, 2);
	SLprint(pList);

	SLPushFront(&pList, 3);
	SLprint(pList);

	SLPushFront(&pList, 4);
	SLprint(pList);

	SLPushBack(&pList, 6);
	SLprint(pList);

	SLPushBack(&pList, 7);
	SLprint(pList);

	SLPushBack(&pList, 8);
	SLprint(pList);

}

void Test3()
{
	SLLNode* pList = NULL;
	SLPushFront(&pList, 1);
	SLprint(pList);

	SLPushFront(&pList, 2);
	SLprint(pList);

	SLPushBack(&pList, 6);
	SLprint(pList);

	SLPushBack(&pList, 7);
	SLprint(pList);

	SLPushBack(&pList, 8);
	SLprint(pList);

	SLPopFront(&pList);
	SLprint(pList);

	SLPopFront(&pList);
	SLprint(pList);

	SLPopFront(&pList);
	SLprint(pList);

	SLPopFront(&pList);
	SLprint(pList);

	SLPopFront(&pList);
	SLprint(pList);
}

void Test4()
{
	SLLNode* pList = NULL;
	SLPushFront(&pList, 1);
	SLprint(pList);

	SLPushFront(&pList, 2);
	SLprint(pList);

	SLPushBack(&pList, 6);
	SLprint(pList);

	SLPushBack(&pList, 7);
	SLprint(pList);

	SLPushBack(&pList, 8);
	SLprint(pList);

	SLPushBack(&pList, 3);
	SLprint(pList);

	SLPushBack(&pList, 4);
	SLprint(pList);

	SLPushBack(&pList, 5);
	SLprint(pList);

	SLPushBack(&pList, 9);
	SLprint(pList);

	SLPopFront(&pList);
	SLprint(pList);

	SLPopFront(&pList);
	SLprint(pList);

	SLPopFront(&pList);
	SLprint(pList);

	SLPopFront(&pList);
	SLprint(pList);

	SLPopBack(&pList);
	SLprint(pList);

	SLPopBack(&pList);
	SLprint(pList);

	SLPopBack(&pList);
	SLprint(pList);

	SLPopBack(&pList);
	SLprint(pList);
}

void Test5()
{
	SLLNode* pList = NULL;
	SLPushFront(&pList, 1);
	SLPushFront(&pList, 2);
	SLPushBack(&pList, 7);
	SLPushBack(&pList, 8);
	SLPushBack(&pList, 3);
	SLPushBack(&pList, 4);
	SLPushBack(&pList, 5);
	SLPushBack(&pList, 9);
	SLprint(pList);
	SLPopFront(&pList);
	SLPopFront(&pList);
	SLPopBack(&pList);
	SLprint(pList);

	SLLNode*pos=SLFind(pList, 8);
	if (pos)
		SLInsertAfter(pos, 20);
	SLprint(pList);

	pos = SLFind(pList, 8);
	if (pos)
		SLInsert(&pList,pos, 30);
	SLprint(pList);

	pos = SLFind(pList, 8);
	if (pos)
		SLErase(&pList, pos);
	SLprint(pList);

	pos = SLFind(pList, 4);
	if (pos)
		SLEraseAfter(&pList, pos);
	SLprint(pList);
}
int main()
{
	//Test1();
	//Test2();
	//Test3();
	//Test4();
	Test5();
	return 0;
}